//
//  ChangePwdViewController.m
//  HTP
//
//  Created by 陈钱钿 on 15/11/4.
//  Copyright © 2015年 nit. All rights reserved.
//

#import "ChangePwdViewController.h"
#define kBorder 20
#define cellHeight 40
@interface ChangePwdViewController ()
@property (nonatomic, retain) UITextField *firstPwd;
@property (nonatomic, retain) UITextField *confirmPwd;
@end

@implementation ChangePwdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addCustomTitleWithTitle:@"密码修改"];
    self.view.backgroundColor = [UIColor colorWithRed:233.0/255 green:233.0/255 blue:233.0/255 alpha:1];
    //去掉返回键的字
//    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(NSIntegerMin, NSIntegerMin) forBarMetrics:UIBarMetricsDefault];
    [self addCustomBackWithAction:@selector(doBack) normalImg:[UIImage imageNamed:@"back"] selectImg:[UIImage imageNamed:@"back"] withPadding:5];
    
    [self initUI];
}
//绘制UI
- (void)initUI {
    UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, kBorder, ScreenWidth, cellHeight*2)];
    newView.backgroundColor = [UIColor whiteColor];
    self.firstPwd = [[UITextField alloc] initWithFrame:CGRectMake(kBorder, 0, ScreenWidth, cellHeight)];
    self.firstPwd.placeholder = @"请输入新密码";
    self.firstPwd.secureTextEntry = YES;
    [newView addSubview:self.firstPwd];
    UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(kBorder, CGRectGetMaxY(self.firstPwd.frame), ScreenWidth-2*kBorder, 1)];
    line.image = [UIImage imageNamed:@"settingline"];
    [newView addSubview:line];
    self.confirmPwd = [[UITextField alloc] initWithFrame:CGRectMake(kBorder, CGRectGetMaxY(line.frame), ScreenWidth, cellHeight)];
    self.confirmPwd.placeholder = @"再次输入密码";
    self.confirmPwd.secureTextEntry = YES;
    [newView addSubview:self.confirmPwd];
    
    [self.view addSubview:newView];
    
    UIButton *confirmBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(newView.frame)+kBorder, ScreenWidth, cellHeight)];
    [confirmBtn setBackgroundColor:[UIColor whiteColor]];
    [confirmBtn setTitle:@"确认" forState:UIControlStateNormal];
    [confirmBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.view addSubview:confirmBtn];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}

- (void)doBack{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
